{
ID: phamnamlo3
LANG : PASCAL
PROB : packrec
}

program PACKREC;
const
  fi = 'packrec.in';
  fo = 'packrec.out';
type
  rec = record
          a, b : integer;
        end;
  dat = record
          x1, y1, x2, y2 : integer;
        end;
  stt = record
          v, s : integer;
        end;
var
  h : array[1..4] of rec;
  put : array[1..4] of dat;
  px, py : array[0..7] of stt;
  free : array[1..4] of boolean;
  left, right, S, ra, rb, sx, sy, nho : integer;
  ok, done, first : boolean;

procedure swap(var x, y : integer);
var
  temp : integer;
begin
  temp := x;
  x := y;
  y := temp;
end;

function max(x, y : integer) : integer;
begin
  if x > y then max := x
  else max := y;
end;

function min(x, y : integer) : integer;
begin
  if x > y then min := y
  else min := x;
end;

procedure inp;
var
  i : integer;
begin
  ra := 0;
  rb := 0;
  left := 0;
  nho := maxint;
  for i := 1 to 4 do
    with h[i] do
    begin
      read(a, b);
      if a > b then swap(a, b);
      ra := ra + a;
      rb := max(rb, b);
      nho := min(nho, a);
      left := left + a*b;
    end;
  right := ra*rb;
end;

procedure init;
begin
  sx := 0;
  sy := 0;
  fillchar(free, sizeof(free), true);
  fillchar(px, sizeof(px), 0);
  fillchar(py, sizeof(py), 0);
end;

function overlap(h1, h2 : dat) : boolean;
var
  lx, rx, uy, dy : integer;
begin
  lx := max(h1.x1, h2.x1);
  rx := min(h1.x2, h2.x2);
  dy := max(h1.y1, h2.y1);
  uy := min(h1.y2, h2.y2);
  overlap := (lx < rx) and (dy < uy);
end;

procedure update(x, y : integer);
var
  i : integer;
  fx, fy : boolean;
begin
  fx := false;
  fy := false;
  for i := 1 to sx do
    if px[i].v = x then
    begin
      inc(px[i].s);
      fx := true;
      break;
    end;
  for i := 1 to sy do
    if py[i].v = y then
    begin
      inc(py[i].s);
      fy := true;
      break;
    end;

  if not fx then
    for i := sx+1 downto 1 do
      if px[i-1].v < x then
      begin
        inc(sx);
        move(px[i], px[i+1], sizeof(px[0])*(sx-i));
        px[i].v := x;
        px[i].s := 1;
        break;
      end;
  if not fy then
    for i := sy+1 downto 1 do
      if py[i-1].v < y then
      begin
        inc(sy);
        move(py[i], py[i+1], sizeof(py[0])*(sy-i));
        py[i].v := y;
        py[i].s := 1;
        break;
      end;
end;

procedure return(x, y : integer);
var
  i : integer;
begin
  for i := 1 to sx do
    if px[i].v = x then
    begin
      dec(px[i].s);
      if px[i].s > 0 then break;
      move(px[i+1], px[i], sizeof(px[0])*(sx-i));
      dec(sx);
      break;
    end;
  for i := 1 to sy do
    if py[i].v = y then
    begin
      dec(py[i].s);
      if py[i].s > 0 then break;
      move(py[i+1], py[i], sizeof(py[0])*(sy-i));
      dec(sy);
      break;
    end;
end;

procedure try(k : integer);
var
  i, j, r, q, xoay : integer;
  de : boolean;
  temp : rec;
begin
  if k = 5 then
  begin
    ok := true;
    exit;
  end;
  with put[k] do
    for r := 1 to 4 do
      if free[r] then
      begin
        temp := h[r];
        with temp do
          for xoay := 0 to 1 do
          begin
            for i := 0 to sx do
              for j := 0 to sy do
              begin
                x1 := px[i].v;
                y1 := py[j].v;
                x2 := px[i].v + a;
                y2 := py[j].v + b;
                if (x2 > ra) or (y2 > rb) then continue;
                de := false;
                for q := 1 to k-1 do
                  if overlap(put[q], put[k]) then
                  begin
                    de := true;
                    break;
                  end;
                if de then continue;
                free[r] := false;
                update(x2, y2);
                try(k+1);
                if ok then exit;
                return(x2, y2);
                free[r] := true;
              end;
            if a = b then break
            else swap(a, b);
          end;
      end;
end;

procedure process;
begin
  done := false;
  first := true;
  for S := left to right do
  begin
    ok := false;
    for ra := nho to trunc(sqrt(S)) do
      if S mod ra = 0 then
      begin
        rb := S div ra;
        init;
        try(1);
        if ok then
        begin
          if first then
          begin
            writeln(S);
            first := false;
          end;
          writeln(ra, ' ', rb);
          done := true;
          ok := false;
        end;
      end;
    if done then break;
  end;
end;

begin
  assign(input, fi); reset(input);
  assign(output, fo); rewrite(output);
  inp;
  process;
  close(output);
  close(input);
end.